﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BA2009.Entities;
using BA2009.Data.DataAccess;

namespace BA2009.Tests.Fakes
{
    public class FakePageRepository:RepositoryBase<Page>,IPageRespository
    {

        private IList<Page> pages;

        public FakePageRepository(IList<Page> pages)
        {
            this.pages = pages;
        }

        public override IQueryable<Page> FindAll()
        {
            return pages.AsQueryable();
        }

        public override Page GetById(int id)
        {
            return pages.AsQueryable().SingleOrDefault(page => page.PageID == id);
        }

   

        protected override object GetLinqEntity(int id)
        {
            throw new NotImplementedException();
        }

        protected override void Save(object linqEnity, BA2009.DataAccess.Context.BA2009Context dbContext, params object[] maps)
        {
            throw new NotImplementedException();
        }

        protected override void Delete(int id, BA2009.DataAccess.Context.BA2009Context dbContext)
        {
            throw new NotImplementedException();
        }

        protected override void Update(object itemToUpdate, object orginialItem, BA2009.DataAccess.Context.BA2009Context dbContext, params object[] maps)
        {
            throw new NotImplementedException();
        }
    }

    public class FakeBannerRepository : RepositoryBase<Banner>, IBannerRepository
    {
        private IList<Banner> banners;

        public FakeBannerRepository(IList<Banner> banners)
        {
            this.banners = banners;
        }

        public override IQueryable<Banner> FindAll()
        {
            return banners.AsQueryable();
        }

        public override Banner GetById(int id)
        {
            return banners.AsQueryable().SingleOrDefault(b => b.BannerID == id);
        }

        protected override void Save(object linqEnity, BA2009.DataAccess.Context.BA2009Context dbContext, params object[] maps)
        {
            throw new NotImplementedException();
        }

        protected override void Delete(int id, BA2009.DataAccess.Context.BA2009Context dbContext)
        {
            throw new NotImplementedException();
        }

        protected override void Update(object itemToUpdate, object orginialItem, BA2009.DataAccess.Context.BA2009Context dbContext, params object[] maps)
        {
            throw new NotImplementedException();
        }

        protected override object GetLinqEntity(int id)
        {
            throw new NotImplementedException();
        }



        #region IBannerRepository Members

        public void Ahah()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
